package cli

import (
	"github.com/fatih/color"
	"github.com/spf13/cobra"
	"server"
	"conf"
)

func InitCmd() {
	// config
	config := conf.NewConfig()
	// print banner
	color.Cyan(cmdBanner)
	// CMD introduction
	rootCmd := &cobra.Command{
		Use:   "bili-news",
		Short: cmdIntroduce,
		Long:  cmdIntroduce,
		Run: func(cmd *cobra.Command, args []string) {
			server.StartWebService(config)
		},
	}
	rootCmd.PersistentFlags().StringVarP(&config.ListenURL, "listen", "l", "0.0.0.0:9000", "listen url")
	rootCmd.Execute()
}
